/*    */ package com.zimbra.cs.service.authenticator;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import java.security.Principal;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class SSOAuthenticator
/*    */ {
/*    */   protected HttpServletRequest req;
/*    */   protected HttpServletResponse resp;
/*    */   
/*    */   public static class ZimbraPrincipal
/*    */     implements Principal
/*    */   {
/*    */     private String authenticationName;
/*    */     private Account account;
/*    */     
/*    */     ZimbraPrincipal(String authenticationName, Account account)
/*    */       throws ServiceException
/*    */     {
/* 49 */       if (authenticationName == null) {
/* 50 */         throw ServiceException.INVALID_REQUEST("no authentication name", null);
/*    */       }
/* 52 */       if (account == null) {
/* 53 */         throw ServiceException.DEFEND_ACCOUNT_HARVEST(authenticationName);
/*    */       }
/*    */       
/* 56 */       ZimbraLog.account.debug("SSOAuthenticator - %s resolved to Zimbra account %s", new Object[] { authenticationName, account.getName() });
/*    */       
/*    */ 
/* 59 */       this.authenticationName = authenticationName;
/* 60 */       this.account = account;
/*    */     }
/*    */     
/*    */ 
/*    */     public String getName()
/*    */     {
/* 66 */       return this.authenticationName;
/*    */     }
/*    */     
/*    */     public Account getAccount()
/*    */     {
/* 71 */       return this.account;
/*    */     }
/*    */   }
/*    */   
/*    */   public static class SSOAuthenticatorServiceException extends AccountServiceException
/*    */   {
/*    */     public static final String NO_CLIENT_CERTIFICATE = "account.NO_CLIENT_CERTIFICATE";
/*    */     public static final String SENT_CHALLENGE = "account.SENT_CHALLENGE";
/*    */     
/*    */     protected SSOAuthenticatorServiceException(String message, String code, boolean isReceiversFault, Throwable cause) {
/* 81 */       super(code, isReceiversFault, cause);
/*    */     }
/*    */     
/*    */     public static SSOAuthenticatorServiceException NO_CLIENT_CERTIFICATE() {
/* 85 */       return new SSOAuthenticatorServiceException("no client certificate", "account.NO_CLIENT_CERTIFICATE", false, null);
/*    */     }
/*    */     
/*    */     public static SSOAuthenticatorServiceException SENT_CHALLENGE() {
/* 89 */       return new SSOAuthenticatorServiceException("sent challenge", "account.SENT_CHALLENGE", false, null);
/*    */     }
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   SSOAuthenticator(HttpServletRequest req, HttpServletResponse resp)
/*    */   {
/* 97 */     this.req = req;
/* 98 */     this.resp = resp;
/*    */   }
/*    */   
/*    */   public abstract String getAuthType();
/*    */   
/*    */   public abstract ZimbraPrincipal authenticate()
/*    */     throws ServiceException;
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/authenticator/SSOAuthenticator.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */